/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Classes;

import java.io.Serializable;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Jaroslav
 */
@Entity
@Table(name = "bug")
@NamedQueries({@NamedQuery(name = "Bug.findByBugId", query = "SELECT b FROM Bug b WHERE b.bugId = :bugId"), 
@NamedQuery(name = "Bug.findByPriorityId", query = "SELECT b FROM Bug b WHERE b.priorityId = :priorityId"), 
@NamedQuery(name = "Bug.findByUserId", query = "SELECT b FROM Bug b WHERE b.userId = :userId"), 
@NamedQuery(name = "Bug.findByComponentId", query = "SELECT b FROM Bug b WHERE b.componentId = :componentId"), 
@NamedQuery(name = "Bug.findByVersionId", query = "SELECT b FROM Bug b WHERE b.versionId = :versionId"), 
@NamedQuery(name = "Bug.findByProjectId", query = "SELECT b FROM Bug b WHERE b.projectId = :projectId"), 
@NamedQuery(name = "Bug.findByBugTitle", query = "SELECT b FROM Bug b WHERE b.bugTitle = :bugTitle"), 
@NamedQuery(name = "Bug.findByKeywords", query = "SELECT b FROM Bug b WHERE b.keywords = :keywords"), 
@NamedQuery(name = "Bug.findByUserEmail", query = "SELECT b FROM Bug b WHERE b.userEmail = :userEmail"), 
@NamedQuery(name = "Bug.findByAddTime", query = "SELECT b FROM Bug b WHERE b.addTime = :addTime")})
public class Bug implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "bug_id", nullable = false)
    private Integer bugId;
    @Column(name = "priority_id", nullable = false)
    private int priorityId;
    @Column(name = "user_id", nullable = false)
    private int userId;
    @Column(name = "component_id", nullable = false)
    private int componentId;
    @Column(name = "version_id", nullable = false)
    private int versionId;
    @Column(name = "state", nullable = false)
    private String bugState;
    @Column(name = "project_id", nullable = false)
    private int projectId;
    @Column(name = "bug_title", nullable = false)
    private String bugTitle;
    @Lob
    @Column(name = "description", nullable = false)
    private String description;
    @Column(name = "keywords", nullable = false)
    private String keywords;
    @Column(name = "user_email", nullable = false)
    private String userEmail;
    @Column(name = "add_time", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date addTime;
    
    public Bug() {
    }

    public Bug(Integer bugId) {
        this.bugId = bugId;
    }

    public Bug(Integer bugId, int priorityId, int userId, int componentId, int versionId, String bugState, int projectId, String bugTitle, String description, String keywords, String userEmail, Date addTime) {
        this.bugId = bugId;
        this.priorityId = priorityId;
        this.userId = userId;
        this.componentId = componentId;
        this.versionId = versionId;
        this.bugState = bugState;
        this.projectId = projectId;
        this.bugTitle = bugTitle;
        this.description = description;
        this.keywords = keywords;
        this.userEmail = userEmail;
        this.addTime = addTime;
    }

    public Integer getBugId() {
        return bugId;
    }

    public void setBugId(Integer bugId) {
        this.bugId = bugId;
    }

    public int getPriorityId() {
        return priorityId;
    }

    public void setPriorityId(int priorityId) {
        this.priorityId = priorityId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getComponentId() {
        return componentId;
    }

    public void setComponentId(int componentId) {
        this.componentId = componentId;
    }

    public int getVersionId() {
        return versionId;
    }

    public void setVersionId(int versionId) {
        this.versionId = versionId;
    }

    public String getState() {
        return bugState;
    }

    public void setState(String state) {
        this.bugState = state;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getBugTitle() {
        return bugTitle;
    }

    public void setBugTitle(String bugTitle) {
        this.bugTitle = bugTitle;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bugId != null ? bugId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bug)) {
            return false;
        }
        Bug other = (Bug) object;
        if ((this.bugId == null && other.bugId != null) || (this.bugId != null && !this.bugId.equals(other.bugId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Classes.Bug[bugId=" + bugId + "]";
    }

}
